<?php
namespace Admin\Model;

use Think\Model;

class AttendModel extends Model {


    public function getAttendByTid($tid) {

        if (empty($tid)) return null;

        $result = $this->table("__ATTEND__ attend, __STUDENT__ student, __TIMETABLE__ timetable")
                       ->field("student.student_id , student.name AS student_name, timetable.week,timetable.xq,timetable.start,timetable.end,attend.status")
                       ->where("attend.teachplan_id = {$tid} AND attend.student_id = student.id AND attend.timetable_id = timetable.id ")
                       ->select();
        //p($this->getLastSql());
        if (empty($result)) return null;
        return $result;

    }


}